package com.feishi.core.util.poi.jxls;

import org.jxls.common.Context;
import org.jxls.util.JxlsHelper;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;

/**
 * @version 1.0
 * @auth caixq
 * @time 18-5-25 10:49
 **/
public class JxlsUtil {
    public static void exportExcel(InputStream is, OutputStream os, Map<String, Object> data) throws IOException {
        Context context = new Context();
        if (data != null) {
            for (String key : data.keySet()) {
                context.putVar(key, data.get(key));
            }
        }
        JxlsHelper.getInstance().processTemplate(is, os, context);
    }
}
